package cn.wolfcode.web.controller;

import cn.wolfcode.domain.Business;
import cn.wolfcode.service.IBusinessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class IndexController {
    @Autowired
    private IBusinessService businessService;

    //获取总店 把数据显示在首页
    @RequestMapping("/index")
    public String list(Model model) {
        Business business = businessService.selectMainStore();
        model.addAttribute("business", business);
        //获取所有门店信息
        List<Business> businesses = businessService.selectBusinessList();
        model.addAttribute("businesses", businesses);
        return "index";
    }

}
